package com.company.service.impl;

import com.company.entity.user;
import com.company.service.StartService;
import com.company.utils.ServiceFactory;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Denglu implements StartService {
    Scanner sc=new Scanner(System.in);

    public int panduan(String shu, String mi,List list){
        for (int i = 0; i < list.size(); i++) {
            Logdengluplus l=(Logdengluplus)list.get(i);
            if(shu.equals(l.getName())&&mi.equals(l.getMima())){
                return 1;
            }
        }
        return 0;
    }
    @Override
    public List ex(List list) {
        System.out.println("-----登录-----");
        System.out.println("输入姓名：");
        String shu=sc.next();
        System.out.println("输入密码：");
        String mi=sc.next();
        int iret=panduan(shu,mi,list);
        if(iret==1){
            System.out.println("用户登录成功");
            StartService S= ServiceFactory.getbone("xiaos");
            S.ex(list);
        }else {
            System.out.println("用户未注册");
        }
        return null;
    }
}
